package com.blog.cloud.core.utils;

import java.util.Random;

/**
 * 短信验证码生成
 */
public class RandomUtil {

    private static final Random random = new Random();

    public static String generalFourRandom() {
        StringBuilder four = new StringBuilder(4);
        for (int i = 0; i < 4; i++) {
            String number = String.valueOf(random.nextInt(10));
            four.append(number);
        }
        return four.toString();
    }

    public static String generalSixRandom() {
        StringBuilder six = new StringBuilder(6);
        for (int i = 0; i < 6; i++) {
            String number = String.valueOf(random.nextInt(10));
            six.append(number);
        }
        return six.toString();
    }

}
